<?php

namespace App\Console\Commands;

use App\Student;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;

class SendEmails extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'email:send';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'send your email';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        DB::beginTransaction();
        $data=[
            [
            'name'=>'syj10','age'=>18,'sex'=>10],
            ['name'=>'syj20','age'=>18,'sex'=>10]
        ];
//        DB::table('students')->insert($data);
        $student=new  Student();
        $re=$student::insert($data);
        DB::commit();
//        DB::rollBack();
        //
    }
}
